﻿using System;
using System.Collections.ObjectModel;
using System.Xml.Serialization;
using EpiNEXT.Core.Fields.Properties;

namespace EpiNEXT.Core.Fields
{
    [Serializable()]
    public class ComboBoxField : FieldWithSeparatePrompt, IInputField
    {
        public ComboBoxField()
            : base()
        {
            InputFontSize = Constants.DEFAULT_INPUT_FONT_SIZE;
            PromptFontSize = Constants.DEFAULT_PROMPT_FONT_SIZE;
            InputBorderThickness = new Thickness(1, 1, 1, 1);
            ValuesMustBeUnique = false;
        }

        /// <summary>
        /// The .NET data type for this field
        /// </summary>
        public override string DataType { get { return "System.String"; } }

        [XmlElement]
        public bool ValuesMustBeUnique { get; set; }

        [XmlIgnore]
        public CodeList ListSource { get; set; }

        [XmlElement]
        public string ListSourceName { get; set; }

        [XmlElement]
        public Guid ListSourceCascadeSourceFieldId { get; set; }

        [XmlArray("ListDestinationFields")]
        [XmlArrayItem("ListDestinationField", typeof(ListDestinationField))]
        public ObservableCollection<ListDestinationField> ListDestinationFields { get; set; }
    }
}
